package com.li.server;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

public abstract class BaseGwtServiceServlet extends RemoteServiceServlet {
	@Override
	protected void service(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		String dataServiceType = req.getParameter("icgDataServiceType");
		if (dataServiceType != null && dataServiceType.length() > 0) {
			try
			{
				processNonGwtDataService(dataServiceType, req, resp);
			}
			catch (Exception e)
			{
				throw new ServletException("Error in Service");
			}
		} else {
			super.service(req, resp);
		}
	}
	
	protected abstract void processNonGwtDataService(String dataServiceType, HttpServletRequest req, HttpServletResponse resp)
	throws IOException;
}
